﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.actions {
    import Mechanics.GameMechanicInterfaces.*;
    import Mechanics.*;
    import Classes.*;

    public class ActionBusinessEnter extends NPCAction {

        protected static const GAME_EVENT:String = "NPCEnterAction";

        protected var m_merchant:IMerchant;

        public function ActionBusinessEnter(_arg1:NPC, _arg2:IMerchant){
            super(_arg1);
            this.m_merchant = _arg2;
        }
        override public function update(_arg1:Number):void{
            var _local2:IMechanicUser;
            var _local3:Array;
            super.update(_arg1);
            if ((this.m_merchant is IMechanicUser)){
                _local2 = (this.m_merchant as IMechanicUser);
                _local3 = _local2.getPrioritizedMechanicsForGameEvent(GAME_EVENT);
                if (((_local3) && (_local3.length))){
                    MechanicManager.getInstance().handleAction(_local2, GAME_EVENT, [m_npc]);
                    m_npc.getStateMachine().removeState(this);
                    return;
                };
            };
            this.m_merchant.crowdManager.makeNpcEnterMerchant(m_npc);
            m_npc.getStateMachine().removeState(this);
        }

    }
}//package Classes.actions 
